<style>
.edit-text{color:red;cursor: pointer;}
</style>
<div class="row-content am-cf" id="app">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">体育专题</div>
                </div>
                <div class="widget-body am-fr">
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <form class="am-form-inline" role="form" action="<?php echo url(); ?>">
                        <div class="am-form-group">
                            <input type="text" class="am-form-field" name="tag_name" placeholder="标题">
                        </div>
                        <button type="submit" class="am-btn am-btn-default am-btn-success am-radius am-btn-xs">查找</button>
                        </form>
                    </div>

                    <div class="am-u-sm-12" style="margin-top:10px;">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <a class="am-btn am-btn-default am-btn-success am-radius"
                                       href="<?php echo url('add'); ?>">
                                        <span class="am-icon-plus"></span> 新增
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped
                         tpl-table-black am-text-nowrap">
                            <thead>
                            <tr>
                                <th><input type="checkbox" name="checkall" @click="onCheck" v-model="checked" /></th>
                                <th>ID</th>
                                <th>标题</th>
                                <th>图片</th>
                                <!--
                                <th>排序</th>
                                -->
                                <th>显示</th>
                                <th>浏览</th>
                                <th>更新时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (!$list->isEmpty()): foreach ($list as $item): ?>
                                <tr>
                                    <td class="am-text-middle"><input type="checkbox" class="ids" v-model="checklist" name="ids[]" value="<?php echo $item['id']; ?>"  /></td>
                                    <td class="am-text-middle"><?php echo $item['id']; ?></td>
                                    <td class="am-text-middle">
                                        <p class="item-title"><?php echo $item['title']; ?></p>
                                    </td>
                                    <td class="am-text-middle">
                                        <img src="<?php echo $item['pic']; ?>" width="30" height="30" />
                                    </td>
                                    <!--
                                    <td class="am-text-middle"><?php echo $item['sorts']; ?></td>
                                    -->
                                    <td class="am-text-middle"><?php echo $item['isshow']>0 ? '<font style="color:red;">隐藏</font>' : '<font style="color:green;">显示</font>'; ?></td>
                                    <td class="am-text-middle"><?php echo $item['view']; ?></td>
                                    <td class="am-text-middle"><?php echo $item['update_time']; ?></td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="<?php echo url('edit',
                                                ['id' => $item['id']]); ?>">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a>
                                            <a href="javascript:;" class="item-delete tpl-table-black-operation-del"
                                               data-id="<?php echo $item['id']; ?>">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="9" class="am-text-center">暂无记录</td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>    
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr"><?php echo $list->render(); ?> </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：<?php echo $list->total(); ?></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
$(function () {

    // 删除元素
    var url = "<?php echo url('delete'); ?>";
    $('.item-delete').delete('id', url);


});
</script>

